Optimal. Leaf size=95 \[ -\frac {d^2 x}{4 b^2}+\frac {(c+d x)^3}{6 d}+\frac {d (c+d x) \cos ^2(a+b x)}{2 b^2}-\frac {d^2 \cos (a+b x) \sin (a+b x)}{4 b^3}+\frac {(c+d x)^2 \cos (a+b x) \sin (a+b x)}{2 b} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.04, antiderivative size = 95, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 4, integrand size = 16, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.250, Rules used = {3392, 32, 2715,
8} \begin {gather*} -\frac {d^2 \sin (a+b x) \cos (a+b x)}{4 b^3}+\frac {d (c+d x) \cos ^2(a+b x)}{2 b^2}+\frac {(c+d x)^2 \sin (a+b x) \cos (a+b x)}{2 b}-\frac {d^2 x}{4 b^2}+\frac {(c+d x)^3}{6 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 32
Rule 2715
Rule 3392
Rubi steps
\begin {align*} \int (c+d x)^2 \cos ^2(a+b x) \, dx &=\frac {d (c+d x) \cos ^2(a+b x)}{2 b^2}+\frac {(c+d x)^2 \cos (a+b x) \sin (a+b x)}{2 b}+\frac {1}{2} \int (c+d x)^2 \, dx-\frac {d^2 \int \cos ^2(a+b x) \, dx}{2 b^2}\\ &=\frac {(c+d x)^3}{6 d}+\frac {d (c+d x) \cos ^2(a+b x)}{2 b^2}-\frac {d^2 \cos (a+b x) \sin (a+b x)}{4 b^3}+\frac {(c+d x)^2 \cos (a+b x) \sin (a+b x)}{2 b}-\frac {d^2 \int 1 \, dx}{4 b^2}\\ &=-\frac {d^2 x}{4 b^2}+\frac {(c+d x)^3}{6 d}+\frac {d (c+d x) \cos ^2(a+b x)}{2 b^2}-\frac {d^2 \cos (a+b x) \sin (a+b x)}{4 b^3}+\frac {(c+d x)^2 \cos (a+b x) \sin (a+b x)}{2 b}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.20, size = 77, normalized size = 0.81 \begin {gather*} \frac {4 b^3 x \left (3 c^2+3 c d x+d^2 x^2\right )+6 b d (c+d x) \cos (2 (a+b x))+3 \left (-d^2+2 b^2 (c+d x)^2\right ) \sin (2 (a+b x))}{24 b^3} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(288\) vs.
\(2(85)=170\).
time = 0.09, size = 289, normalized size = 3.04
method | result | size |
risch | \(\frac {d^{2} x^{3}}{6}+\frac {c d \,x^{2}}{2}+\frac {c^{2} x}{2}+\frac {c^{3}}{6 d}+\frac {d \left (d x +c \right ) \cos \left (2 b x +2 a \right )}{4 b^{2}}+\frac {\left (2 d^{2} x^{2} b^{2}+4 b^{2} c d x +2 b^{2} c^{2}-d^{2}\right ) \sin \left (2 b x +2 a \right )}{8 b^{3}}\) | \(98\) |
derivativedivides | \(\frac {\frac {a^{2} d^{2} \left (\frac {\cos \left (b x +a \right ) \sin \left (b x +a \right )}{2}+\frac {b x}{2}+\frac {a}{2}\right )}{b^{2}}-\frac {2 a c d \left (\frac {\cos \left (b x +a \right ) \sin \left (b x +a \right )}{2}+\frac {b x}{2}+\frac {a}{2}\right )}{b}-\frac {2 a \,d^{2} \left (\left (b x +a \right ) \left (\frac {\cos \left (b x +a \right ) \sin \left (b x +a \right )}{2}+\frac {b x}{2}+\frac {a}{2}\right )-\frac {\left (b x +a \right )^{2}}{4}-\frac {\left (\sin ^{2}\left (b x +a \right )\right )}{4}\right )}{b^{2}}+c^{2} \left (\frac {\cos \left (b x +a \right ) \sin \left (b x +a \right )}{2}+\frac {b x}{2}+\frac {a}{2}\right )+\frac {2 c d \left (\left (b x +a \right ) \left (\frac {\cos \left (b x +a \right ) \sin \left (b x +a \right )}{2}+\frac {b x}{2}+\frac {a}{2}\right )-\frac {\left (b x +a \right )^{2}}{4}-\frac {\left (\sin ^{2}\left (b x +a \right )\right )}{4}\right )}{b}+\frac {d^{2} \left (\left (b x +a \right )^{2} \left (\frac {\cos \left (b x +a \right ) \sin \left (b x +a \right )}{2}+\frac {b x}{2}+\frac {a}{2}\right )+\frac {\left (b x +a \right ) \left (\cos ^{2}\left (b x +a \right )\right )}{2}-\frac {\cos \left (b x +a \right ) \sin \left (b x +a \right )}{4}-\frac {b x}{4}-\frac {a}{4}-\frac {\left (b x +a \right )^{3}}{3}\right )}{b^{2}}}{b}\) | \(289\) |
default | \(\frac {\frac {a^{2} d^{2} \left (\frac {\cos \left (b x +a \right ) \sin \left (b x +a \right )}{2}+\frac {b x}{2}+\frac {a}{2}\right )}{b^{2}}-\frac {2 a c d \left (\frac {\cos \left (b x +a \right ) \sin \left (b x +a \right )}{2}+\frac {b x}{2}+\frac {a}{2}\right )}{b}-\frac {2 a \,d^{2} \left (\left (b x +a \right ) \left (\frac {\cos \left (b x +a \right ) \sin \left (b x +a \right )}{2}+\frac {b x}{2}+\frac {a}{2}\right )-\frac {\left (b x +a \right )^{2}}{4}-\frac {\left (\sin ^{2}\left (b x +a \right )\right )}{4}\right )}{b^{2}}+c^{2} \left (\frac {\cos \left (b x +a \right ) \sin \left (b x +a \right )}{2}+\frac {b x}{2}+\frac {a}{2}\right )+\frac {2 c d \left (\left (b x +a \right ) \left (\frac {\cos \left (b x +a \right ) \sin \left (b x +a \right )}{2}+\frac {b x}{2}+\frac {a}{2}\right )-\frac {\left (b x +a \right )^{2}}{4}-\frac {\left (\sin ^{2}\left (b x +a \right )\right )}{4}\right )}{b}+\frac {d^{2} \left (\left (b x +a \right )^{2} \left (\frac {\cos \left (b x +a \right ) \sin \left (b x +a \right )}{2}+\frac {b x}{2}+\frac {a}{2}\right )+\frac {\left (b x +a \right ) \left (\cos ^{2}\left (b x +a \right )\right )}{2}-\frac {\cos \left (b x +a \right ) \sin \left (b x +a \right )}{4}-\frac {b x}{4}-\frac {a}{4}-\frac {\left (b x +a \right )^{3}}{3}\right )}{b^{2}}}{b}\) | \(289\) |
norman | \(\frac {c d \,x^{2} \left (\tan ^{2}\left (\frac {b x}{2}+\frac {a}{2}\right )\right )+\frac {d^{2} x^{2} \tan \left (\frac {b x}{2}+\frac {a}{2}\right )}{b}+\frac {d^{2} x^{3}}{6}+\frac {c d \,x^{2}}{2}+\frac {d^{2} x^{3} \left (\tan ^{2}\left (\frac {b x}{2}+\frac {a}{2}\right )\right )}{3}+\frac {d^{2} x^{3} \left (\tan ^{4}\left (\frac {b x}{2}+\frac {a}{2}\right )\right )}{6}+\frac {\left (2 b^{2} c^{2}-d^{2}\right ) \tan \left (\frac {b x}{2}+\frac {a}{2}\right )}{2 b^{3}}-\frac {\left (2 b^{2} c^{2}-d^{2}\right ) \left (\tan ^{3}\left (\frac {b x}{2}+\frac {a}{2}\right )\right )}{2 b^{3}}+\frac {\left (2 b^{2} c^{2}+d^{2}\right ) x}{4 b^{2}}-\frac {2 c d \left (\tan ^{2}\left (\frac {b x}{2}+\frac {a}{2}\right )\right )}{b^{2}}+\frac {c d \,x^{2} \left (\tan ^{4}\left (\frac {b x}{2}+\frac {a}{2}\right )\right )}{2}-\frac {d^{2} x^{2} \left (\tan ^{3}\left (\frac {b x}{2}+\frac {a}{2}\right )\right )}{b}+\frac {\left (2 b^{2} c^{2}-3 d^{2}\right ) x \left (\tan ^{2}\left (\frac {b x}{2}+\frac {a}{2}\right )\right )}{2 b^{2}}+\frac {\left (2 b^{2} c^{2}+d^{2}\right ) x \left (\tan ^{4}\left (\frac {b x}{2}+\frac {a}{2}\right )\right )}{4 b^{2}}+\frac {2 c d x \tan \left (\frac {b x}{2}+\frac {a}{2}\right )}{b}-\frac {2 c d x \left (\tan ^{3}\left (\frac {b x}{2}+\frac {a}{2}\right )\right )}{b}}{\left (1+\tan ^{2}\left (\frac {b x}{2}+\frac {a}{2}\right )\right )^{2}}\) | \(337\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 222 vs.
\(2 (85) = 170\).
time = 0.31, size = 222, normalized size = 2.34 \begin {gather*} \frac {6 \, {\left (2 \, b x + 2 \, a + \sin \left (2 \, b x + 2 \, a\right )\right )} c^{2} - \frac {12 \, {\left (2 \, b x + 2 \, a + \sin \left (2 \, b x + 2 \, a\right )\right )} a c d}{b} + \frac {6 \, {\left (2 \, b x + 2 \, a + \sin \left (2 \, b x + 2 \, a\right )\right )} a^{2} d^{2}}{b^{2}} + \frac {6 \, {\left (2 \, {\left (b x + a\right )}^{2} + 2 \, {\left (b x + a\right )} \sin \left (2 \, b x + 2 \, a\right ) + \cos \left (2 \, b x + 2 \, a\right )\right )} c d}{b} - \frac {6 \, {\left (2 \, {\left (b x + a\right )}^{2} + 2 \, {\left (b x + a\right )} \sin \left (2 \, b x + 2 \, a\right ) + \cos \left (2 \, b x + 2 \, a\right )\right )} a d^{2}}{b^{2}} + \frac {{\left (4 \, {\left (b x + a\right )}^{3} + 6 \, {\left (b x + a\right )} \cos \left (2 \, b x + 2 \, a\right ) + 3 \, {\left (2 \, {\left (b x + a\right )}^{2} - 1\right )} \sin \left (2 \, b x + 2 \, a\right )\right )} d^{2}}{b^{2}}}{24 \, b} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.36, size = 113, normalized size = 1.19 \begin {gather*} \frac {2 \, b^{3} d^{2} x^{3} + 6 \, b^{3} c d x^{2} + 6 \, {\left (b d^{2} x + b c d\right )} \cos \left (b x + a\right )^{2} + 3 \, {\left (2 \, b^{2} d^{2} x^{2} + 4 \, b^{2} c d x + 2 \, b^{2} c^{2} - d^{2}\right )} \cos \left (b x + a\right ) \sin \left (b x + a\right ) + 3 \, {\left (2 \, b^{3} c^{2} - b d^{2}\right )} x}{12 \, b^{3}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 264 vs.
\(2 (85) = 170\).
time = 0.24, size = 264, normalized size = 2.78 \begin {gather*} \begin {cases} \frac {c^{2} x \sin ^{2}{\left (a + b x \right )}}{2} + \frac {c^{2} x \cos ^{2}{\left (a + b x \right )}}{2} + \frac {c d x^{2} \sin ^{2}{\left (a + b x \right )}}{2} + \frac {c d x^{2} \cos ^{2}{\left (a + b x \right )}}{2} + \frac {d^{2} x^{3} \sin ^{2}{\left (a + b x \right )}}{6} + \frac {d^{2} x^{3} \cos ^{2}{\left (a + b x \right )}}{6} + \frac {c^{2} \sin {\left (a + b x \right )} \cos {\left (a + b x \right )}}{2 b} + \frac {c d x \sin {\left (a + b x \right )} \cos {\left (a + b x \right )}}{b} + \frac {d^{2} x^{2} \sin {\left (a + b x \right )} \cos {\left (a + b x \right )}}{2 b} - \frac {c d \sin ^{2}{\left (a + b x \right )}}{2 b^{2}} - \frac {d^{2} x \sin ^{2}{\left (a + b x \right )}}{4 b^{2}} + \frac {d^{2} x \cos ^{2}{\left (a + b x \right )}}{4 b^{2}} - \frac {d^{2} \sin {\left (a + b x \right )} \cos {\left (a + b x \right )}}{4 b^{3}} & \text {for}\: b \neq 0 \\\left (c^{2} x + c d x^{2} + \frac {d^{2} x^{3}}{3}\right ) \cos ^{2}{\left (a \right )} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.41, size = 94, normalized size = 0.99 \begin {gather*} \frac {1}{6} \, d^{2} x^{3} + \frac {1}{2} \, c d x^{2} + \frac {1}{2} \, c^{2} x + \frac {{\left (b d^{2} x + b c d\right )} \cos \left (2 \, b x + 2 \, a\right )}{4 \, b^{3}} + \frac {{\left (2 \, b^{2} d^{2} x^{2} + 4 \, b^{2} c d x + 2 \, b^{2} c^{2} - d^{2}\right )} \sin \left (2 \, b x + 2 \, a\right )}{8 \, b^{3}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 0.21, size = 179, normalized size = 1.88 \begin {gather*} x\,\left (\frac {c^2}{4}-\frac {d^2}{8\,b^2}\right )+x\,\left (\frac {c^2}{4}+\frac {d^2}{8\,b^2}\right )+\frac {d^2\,x^3}{6}-\frac {\sin \left (2\,a+2\,b\,x\right )\,\left (d^2-2\,b^2\,c^2\right )}{8\,b^3}-\frac {x\,\cos \left (2\,a+2\,b\,x\right )\,\left (\frac {c^2}{2}-\frac {d^2}{4\,b^2}\right )}{2}+\frac {x\,\cos \left (2\,a+2\,b\,x\right )\,\left (\frac {c^2}{2}+\frac {d^2}{4\,b^2}\right )}{2}+\frac {c\,d\,x^2}{2}+\frac {d^2\,x^2\,\sin \left (2\,a+2\,b\,x\right )}{4\,b}+\frac {c\,d\,\cos \left (2\,a+2\,b\,x\right )}{4\,b^2}+\frac {c\,d\,x\,\sin \left (2\,a+2\,b\,x\right )}{2\,b} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________